package com.example.skycode6.servlet;

import com.example.skycode6.bean.NewsBean;
import com.example.skycode6.bean.noticeBean;
import com.example.skycode6.dao.NewsDao;
import com.example.skycode6.dao.noticeDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/noticeDetail.html")
public class noticeDetailServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {
        String  NoticeID= req.getParameter("NoticeID");
        int noticeID = Integer.parseInt(NoticeID);
        noticeBean notice = (new noticeDao()).getNoticeByID(noticeID);
        req.setAttribute("title",notice.getNoticeTitle() );
        req.setAttribute("content",notice.getNoticeContent() );
        req.getRequestDispatcher("noticeFrontDetail.jsp").forward(req, resp);
    }
}
